<template>
  <div class="bg-white my-[10px]">
    <BaseHead style="border-bottom: 0">项目文档</BaseHead>
    <el-table :data="documentFileList" class="w-full" border stripe>
      <el-table-column type="index" label="序号" width="60px" />
      <el-table-column label="文档名称">
        <template #default="{ row }">
          <span>{{ row.filename }}</span>
          <el-link type="primary" @click="handleDownload(row.fileId, row.filename)" class="ml-[5px]"
            >下载</el-link
          >
        </template>
      </el-table-column>
      <el-table-column prop="uploadPersonName" label="上传人" />
      <el-table-column prop="uploadTime" label="上传时间" />
    </el-table>
  </div>
</template>

<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import { documentDetail } from "@/api/project/zx/lxxm";
import { handleDownload } from "@/utils/main";
const operateId = inject("id");
const documentFileList = ref([]);
//获取文档信息详情
const getDocumentDetail = async () => {
  try {
    const res = await documentDetail(operateId.value);
    documentFileList.value = res.data.projectDocumentList;
  } catch (error) {
    console.log(error);
  }
};
onMounted(() => {
  getDocumentDetail();
});
</script>

<style scoped lang="scss"></style>
